/******************* 逻辑运算中的假值 ******************** */

function isFalseVal(val) {
  // 数字0会被视为假值
  if (val) {
    console.log(`${val}不是假值`);
  } else {
    console.log(`${val}是假值`);
  }
}

//数字0、-0都是假值
isFalseVal(0);
//null是假值
isFalseVal(null);
//undefined是假值
isFalseVal(undefined);
//NaN是假值
isFalseVal(NaN);
//""空字符串也是假值
isFalseVal("");

let x = new Boolean(null);
if (x) {
  console.log("x");
}

let y = new Boolean(undefined);
isFalseVal(y);
if (y) {
  console.log(y.valueOf);
}

let z = new Boolean(NaN);
isFalseVal(z);
if (z.valueOf()) {
  console.log("z");
}

let t = new Boolean(false);
console.log(t.toString());
if (t.toString()) {
  console.log("t");
}

let p;
let q = new Boolean(p);
if (q) {
  console.log("q");
}

let h = new Boolean([]);
if (h) {
  console.log("h");
}

let g = Boolean(null);
if (g) {
  console.log("g");
}
